import Https from '@/utils/https'

// 获取数据源列表
const queryGetDataSourceListReq = (params) => Https.get('/api/v1/dataApi/getDataSourceList', params)

// 获取表列表供选择
const queryGetTableInfoListReq = (params) => Https.get('/api/v1/dataApi/getTableInfoList', params)

// 获取字段列表
const queryGetTableFieldListReq = (params) => Https.get('/api/v1/dataApi/getTableFieldList', params, { needCode: true })

// 测试API 脚本模式
const queryTestScriptApiReq = (params) => Https.post('/api/v1/dataApi/testScriptApi', params, { needCode: true })

// 测试API  向导模式
const queryTestGuideApiReq = (params) => Https.post('/api/v1/dataApi/tesParamApi', params, { needCode: true })

// API分组
const queryGetApiGroupReq = (params) => Https.get('/api/v1/dataApi/getApiGroup', params)

// 查看日志
const queryLogReq = (params) => Https.get('/api/v1/dataApi/log', params, { needCode: true })

// 保存向导模式API
const querySaveGuideApiReq = (params) => Https.post('/api/v1/dataApi/saveGuideApi', params, { needCode: true })

// 保存脚本模式API
const querySaveScriptApiReq = (params) => Https.post('/api/v1/dataApi/saveScriptApi', params, { needCode: true })

// 保存指标模式API
const querySaveIndexApiReq = (params) => Https.post('/api/v1/dataApi/saveIndexApi', params, { needCode: true })

// 根据脚本获取参数
const queryGetParamsReq = (params) => Https.get('/api/v1/dataApi/getParams', params, { needCode: true })

// 获取指标目录
const queryListCatalogReq = (params) => Https.get('/api/v1/dataApi/listCatalog', params)

// 获取指标列表
const queryGetPublishedIndexReq = (params) => Https.get('/api/v1/dataApi/getPublishedIndex', params)

// 查看详情
const queryGetDataApiDetailByIdReq = (params) => Https.get('/api/v1/dataApi/getDataApiDetailById', { ...params, time: new Date().getTime() }, { needCode: true })

export {
  queryGetDataSourceListReq, queryGetTableInfoListReq, queryGetTableFieldListReq, queryTestScriptApiReq, queryGetApiGroupReq, queryTestGuideApiReq, queryLogReq, querySaveGuideApiReq, queryGetParamsReq, querySaveScriptApiReq, queryListCatalogReq, queryGetPublishedIndexReq, querySaveIndexApiReq, queryGetDataApiDetailByIdReq,
}
